package com.dongdong.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdong.mapper.TbContentCategoryMapper;
import com.dongdong.pojo.TbContentCategory;
import com.dongdong.service.ContentCategoryService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Deacription TODO
 * @Author Lenovo
 * @Date 2020/12/16 11:47
 * @Version 1.0
 **/
@Component
@Service
public class ContentCategoryServiceImpl implements ContentCategoryService {

    @Resource
    private TbContentCategoryMapper tbContentCategoryMapper;

    @Override
    public void updateContentCategory(TbContentCategory contentCategory) {
        tbContentCategoryMapper.updateByPrimaryKeySelective(contentCategory);
    }

    @Override
    public List<TbContentCategory> getContentC() {
        return tbContentCategoryMapper.selectByExample(null);
    }

    @Override
    public void deleteBatch(Long[] ids) {
        tbContentCategoryMapper.deleteBatch(ids);
    }

    @Override
    public TbContentCategory toUpdate(Long id) {
        return tbContentCategoryMapper.selectByPrimaryKey(id);
    }

    @Override
    public void saveContentCategory(TbContentCategory contentCategory) {
        tbContentCategoryMapper.insertSelective(contentCategory);
    }

    @Override
    public List<TbContentCategory> getContentCategory(String name) {
        return tbContentCategoryMapper.getContentCategory(name);
    }
}

